package com.xiaomili.halfsugar.adapter;

import android.support.v7.widget.RecyclerView;
import android.util.SparseArray;
import android.view.View;

/**
 * Created by Administrator on 2016/7/20.
 */
public class CommonHolder extends RecyclerView.ViewHolder {
    private SparseArray<View> mData;

    public CommonHolder(View itemView) {
        super(itemView);
        mData = new SparseArray<>();
    }

    public <T extends View> T findViewById(int itemId) {
        View view = mData.get(itemId);
        if (view == null) {
            view = itemView.findViewById(itemId);
            mData.put(itemId, view);
        }
        return (T) view;
    }
}
